{	Problem: http://codeforces.ru/problemset/problem/50/B
	Verdict: Accepted

}
var i:longint; s:string; res:int64; a:array['a'..'z'] of longint; b:array['0'..'9'] of longint;
begin
readln(s);
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
res:=0;
for i:=1 to length(s) do if s[i] in ['a'..'z'] then inc(a[s[i]]) else inc(b[s[i]]);
for i:=1 to length(S) do if s[i] in ['a'..'z'] then inc(res,a[s[i]]) else inc(res,b[s[i]]);
writeln(res);
end.